package com.qsmx.store.app.main;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.qsmx.store.app.R;
import com.qsmx.store.app.databinding.DelegateSelectAddressBinding;
import com.qsmx.store.core.fusion.FusionPre;
import com.qsmx.store.core.app.Atmos;
import com.qsmx.store.core.delegates.AtmosDelegate;
import com.qsmx.store.core.net.HttpUrl;
import com.qsmx.store.core.util.storage.AtmosPreference;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class AddressDelegate extends AtmosDelegate {

    private DelegateSelectAddressBinding mBinding;

    @Override
    public Object setLayout() {
        return R.layout.delegate_select_address;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {

        mBinding = DelegateSelectAddressBinding.bind(rootView);
        mBinding.btnRealAddress.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AtmosPreference.addCustomStringPre(FusionPre.APP_ELM_INFO, "正式");
                getSupportDelegate().start(new HomeDelegate());
            }
        });
        mBinding.btnDevAddress.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AtmosPreference.addCustomStringPre(FusionPre.APP_ELM_INFO, "测试");
                getSupportDelegate().start(new HomeDelegate());
            }
        });
    }

    @Override
    public boolean onBackPressedSupport() {
        getProxyActivity().finish();
        return super.onBackPressedSupport();
    }
}
